package com.javalong.affairs.module.renwujinzhang.activity.praise;

import android.view.View;
import android.widget.AdapterView;

import com.javalong.affairs.R;
import com.javalong.affairs.base.activity.ToolbarActivity;
import com.javalong.affairs.base.adapter.BaseAdapter;
import com.javalong.affairs.base.constant.BundleKey;
import com.javalong.affairs.base.constant.DataType;
import com.javalong.affairs.base.constant.MapKey;
import com.javalong.affairs.base.constant.RequestKey;
import com.javalong.affairs.base.model.Praise;
import com.javalong.affairs.base.model.Suggest;
import com.javalong.affairs.module.renwujinzhang.activity.suggest.activity.SuggestContentActivity;
import com.javalong.affairs.module.renwujinzhang.activity.suggest.adapter.SuggestAdapter;
import com.javalong.affairs.module.renwujinzhang.fragment.ListViewFragment;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by javalong on 2016/5/22.
 */
public class PraiseListFragment extends ListViewFragment<Praise> {
    @Override
    protected int getDataId() {
        return R.string.data_tracktask_praise_list;
    }

    @Override
    protected Map<String, Object> getMapData() {
        Map<String, Object> param = new HashMap<>();
        param.put(MapKey.ACTION_NAME, "Task");
        param.put(MapKey.METHOD_NAME, "outList_praiseList_detail");
        param.put(MapKey.DATA_RESID, R.string.data_tracktask_praise_list);
        param.put(MapKey.DATA_TYPE, DataType.LIST_PRAISE);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(RequestKey.ID, getArguments().getInt(BundleKey.ID));
        param.put(MapKey.REQUEST_PARAMS, params);
        return param;
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Praise suggest = getData(position - 2);
        if (suggest != null) {
            PraiseContentActivity.toThisActivity(getActivity(), suggest);
        }
    }

    @Override
    protected BaseAdapter getAdapert() {
        return new PraiseAdapter(getActivity(), taskList);
    }

    @Override
    protected void afterInit() {
        ((ToolbarActivity) getActivity()).getSupportActionBar().setTitle("点赞列表");
    }

}
